<template>
	<view :style="Theme">
		<uni-nav-bar leftIcon="arrowleft" :statusBar="true" :fixed="true" :title="info.text" />
		<view class="main">
			<view class="boxWrap" v-for="(item,index) in infoList" :key="index" @click="goNotice(item)">
				<view class="top flex">
					<image class="top_img" src="/static/images/img09.png" mode="widthFix"></image>
					<view class="top_c">{{item.title}}</view>
				</view>
				<view class="con2">发布时间:{{item.addTime}}</view>
				<view class="con3" v-html="item.content"></view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info:{},
				infoList:[]
			}

		},
		onLoad(option) {
			console.log('前一个页面参数')
			console.log(option)
			console.log(JSON.parse(option.info))
			this.info = JSON.parse(option.info)
			console.log(this.info.text)
		},
		onShow() {
			// 获取公告列表
			this.getNoticeList()
		},
		methods: {
			// 跳转公告列表
			goNotice(item) {
				//如果有url，就跳转webview
				if(item.url){
					uni.navigateTo({
						url: '/sub_index/pages/notices/webview?url='+item.url
					})
				}else{
					console.log(item)
					uni.navigateTo({
						url: '/sub_index/pages/notices/detail?id='+item.id
					})
				}
				
			},
			getNoticeList() {
				this.sjuRequest("wx/notice/getNoticeList", 'POST', {
					noticeType: this.info.noticeType,
					page: 1,
					limit: 100
				}).then(res => {
					console.log(res)
					this.infoList = res.data.list
				})
			},
		},

	}
</script>

<style lang="scss">
	.boxWrap {
		padding: 20rpx;
		margin-bottom: 20rpx;
	}

	.top {
		width: 100%;
		height: auto;
		align-items: center;
	}

	.top_img {
		width: 40rpx;
		height: auto;
	}

	.top_c {
		font-size: 32rpx;
		font-weight: bold;
	}

	.con2 {
		margin: 10rpx 0;
		color: #666;
		font-size: 24rpx;
		margin-bottom: 20rpx;
	}

	.con3 {
		line-height: 36rpx;
		font-size: 28rpx;
		height: 68rpx;
		overflow: hidden;
	}
</style>